// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import CustomComponents 1.0

Rectangle {
    width: 1280
    height: 800
    id: page



    //TODO: nicely find number of points
    property int values: 256
    property int valueToValueDistance: Math.floor(page.width/page.values)
    property int eegSamplingRate: 128



    property int currentValue: 0

    //TODO: y scalling
    //TODO: x scalling

    function values(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14)
    {


	var samples = c1.length;

        page.currentValue = (page.currentValue + samples)%page.values;
        progressLine.x1 = channel1.children[page.currentValue].x1;

	channel1.updateValues(page.currentValue, c1);
	channel2.updateValues(page.currentValue, c2);
	channel3.updateValues(page.currentValue, c3);
	channel4.updateValues(page.currentValue, c4);
	channel5.updateValues(page.currentValue, c5);
	channel6.updateValues(page.currentValue, c6);
	channel7.updateValues(page.currentValue, c7);
	channel8.updateValues(page.currentValue, c8);
	channel9.updateValues(page.currentValue, c9);
	channel10.updateValues(page.currentValue, c10);
	channel11.updateValues(page.currentValue, c11);
	channel12.updateValues(page.currentValue, c12);
	channel13.updateValues(page.currentValue, c13);
	channel14.updateValues(page.currentValue, c14);


    }


    Line
    {
        id: progressLine
        x1: 0; y1: 0
        x2: x1; y2: parent.height
        color: "tomato"; penWidth: 1; smooth: true
    }

    EegChannel{id: channel1; name: "channel1"; y: 50; color: "blue"}
    EegChannel{id: channel2; name: "channel2"; y: 100; color: "green"}
    EegChannel{id: channel3; name: "channel3"; y: 150; color: "red"}
    EegChannel{id: channel4; name: "channel4"; y: 200; color: "black"}
    EegChannel{id: channel5; name: "channel4"; y: 250; color: "purple"}
    EegChannel{id: channel6; name: "channel4"; y: 300; color: "orange"}
    EegChannel{id: channel7; name: "channel4"; y: 350; color: "indigo"}
    EegChannel{id: channel8; name: "channel4"; y: 400; color: "olive"}
    EegChannel{id: channel9; name: "channel4"; y: 450; color: "darkgray"}
    EegChannel{id: channel10; name: "channel4"; y: 500; color: "magenta"}
    EegChannel{id: channel11; name: "channel4"; y: 550; color: "lime"}
    EegChannel{id: channel12; name: "channel4"; y: 600; color: "darkred"}
    EegChannel{id: channel13; name: "channel4"; y: 650; color: "navy"}
    EegChannel{id: channel14; name: "channel4"; y: 700; color: "brown"}

}
